unit UFrmBatchAdd;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons, Menus, ActnList;

type
  TFrmBatchAdd = class(TForm)
    btnOK: TBitBtn;
    btnCancel: TBitBtn;
    bvl: TBevel;
    edtStart: TEdit;
    edtEnd: TEdit;
    edtStep: TEdit;
    lblBegin: TLabel;
    lblEnd: TLabel;
    lblStep: TLabel;
    edtPattern: TEdit;
    lblFind: TLabel;
    lblReplace: TLabel;
    edtRepl: TEdit;
    btnDetaile: TBitBtn;
    pm1: TPopupMenu;
    chkFieldValue: TCheckBox;
    actlst1: TActionList;
    actFieldValue: TAction;
    chkFirstRecord: TCheckBox;
    actFirstRecord: TAction;
    chkQuick: TCheckBox;
    actQuick: TAction;
    procedure btnOKClick(Sender: TObject);
    procedure btnCancelClick(Sender: TObject);
    procedure btnDetaileClick(Sender: TObject);
    procedure actFieldValueExecute(Sender: TObject);
    procedure actFirstRecordExecute(Sender: TObject);
    procedure edtStartExit(Sender: TObject);
    procedure actQuickExecute(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

implementation

uses UFrmFavite;

{$R *.dfm}

procedure TFrmBatchAdd.btnOKClick(Sender: TObject);
var  k: Integer;
begin
  if not TryStrToInt(edtStep.Text, k) then
  begin
    ShowMessage('Must be integer');
    Exit;
  end;
  ModalResult := mrOk;
end;

procedure TFrmBatchAdd.btnCancelClick(Sender: TObject);
begin
  edtStart.Text := '0';
  edtEnd.Text := '0';
  edtStep.Text := '0';
end;

procedure TFrmBatchAdd.btnDetaileClick(Sender: TObject);
var
  Frm: TFrmFavite;
begin
  Frm := TFrmFavite.Create(Self);
  Frm.ShowModal;
  edtPattern.Text := Frm.Patten;
  edtRepl.Text := Frm.Exprl; ;
  Frm.Free;
end;

procedure TFrmBatchAdd.actFieldValueExecute(Sender: TObject);
begin
  actFieldValue.Checked := not actFieldValue.Checked;
end;

procedure TFrmBatchAdd.actFirstRecordExecute(Sender: TObject);
begin
  actFirstRecord.Checked := not actFirstRecord.Checked;
end;

procedure TFrmBatchAdd.edtStartExit(Sender: TObject);
begin
//  if StrToInt(edtStart.Text) > StrToInt(edtEnd.Text) then
//    edtEnd.Text := IntToStr(StrToInt(edtStart.Text) + StrToInt(edtEnd.Text));
end;

procedure TFrmBatchAdd.actQuickExecute(Sender: TObject);
begin
  inherited;
  actQuick.Checked := not actQuick.Checked;
end;

end.

